using System;
using System.Collections.Generic;
using System.Text;

namespace GSyncConsole
{
    class FileSize
    {
        private long fileLength;

        public long FileLength
        {
            get { return fileLength; }
            set { fileLength = value; }
        }

        public long SizeInKB
        {
            get { return fileLength / 1024; }
        }

        public long SizeInMB
        {
            get { return SizeInKB / 1024; }
        }

        public bool ValidGmailAttachment
        {
            get { return SizeInMB < 9; }
        }

        public string NormalizeLength
        {
            get
            {
                string normalizeLength = String.Empty;

                if (SizeInMB > 0)
                {
                    normalizeLength = string.Format("{0} MB", SizeInMB);
                }
                else if (SizeInKB > 0)
                {
                    normalizeLength = string.Format("{0} KB", SizeInKB);
                }
                else
                {
                    normalizeLength = string.Format("{0} bytes", FileLength);
                }

                return normalizeLength;
            }
        }

        public FileSize(long fileLength)
        {
            this.FileLength = fileLength;
        }

    }
}
